// pagesGame/pages/main/index.js
var app = getApp(), fetchApi = require("../../../utils/httpPost.js"),
formatTime = require("../../../component/common.js")
import Toast from '../../../component/vant/toast/toast';
import Dialog from '../../../component/vant/dialog/dialog';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isLoading:true,
    loading:false,
    netWork:false,
    hasData:false,
    games:[],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.onHttpInit();
  },
  /**
   * 获取页面数据的 http请求
   */
  onHttpInit: function () {
    var that = this
    fetchApi.httpPost('/titleMenu/menu/list', {
      // menu_type:0,
      service_type: 'game',
    }, function (res) {
      if (res.data.code == 0) {
        if (res.data.totalcount > 0) {
          console.log("服务列表", res)
          that.setData({
            hasData: true,
            games: res.data.data.listMenu
          })
        }
      }
      that.setData({
         isLoading: false, loading: true, netWork: true,
      })
    }, function (res) {
        that.setData({ hasData: false,  isLoading: false,  loading: true, netWork: true })
    })
  },
})